﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Web.Profile;

namespace WebSite.admin.shop
{
    public partial class topic_add03 : System.Web.UI.Page
    {


        // Methods
        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            if (base.Request.QueryString["tid"] != null)
            {
                SQLAccess.DoSql("update DB_Topic set content='" + this.WE_NewsContent.Text.Replace("'", "''") + "' where topicid=" + base.Request.QueryString["tid"] + "");
                base.Response.Write("<script language='javascript'>alert('专题介绍修改成功');window.location.href='topic_add03.aspx?tid=" + base.Request.QueryString["tid"] + "';</script>");
                base.Response.End();
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Session["Adminlogin"] == null)
            {
                base.Response.Write("<script language=javascript>window.top.location.href='../login.aspx';</script>");
                base.Response.End();
            }
            this.ImageButton1.Attributes["onclick"] = "return clicka()";
            if (!base.IsPostBack && (base.Request.QueryString["tid"] != null))
            {
                this.upbind();
            }
        }

        private void upbind()
        {
            string sql = "select top 1 * from DB_Topic where topicid=" + base.Request.QueryString["tid"];
            DataTable table = new DataTable();
            table = SQLAccess.GreatDs(sql).Tables[0];
            this.WE_NewsContent.Text = table.Rows[0]["content"].ToString();
        }


    }
}